package com.litchi.Controllers;

import com.litchi.Repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;
import com.litchi.Ultis.Result;


@RestController
public class UserController {
    @Autowired
    UserRepository userRepository;

    @GetMapping(value = "/user")
    public Result getUser() {
        int page=0,size=10;

        Sort sort = new Sort(Sort.Direction.DESC, "id");

        Pageable pageable = PageRequest.of(page, size, sort);

        return Result.success(userRepository.findALL(pageable));
    }

}
